//package com.kxf.androidtestdemo.activity;
//
//import android.os.Bundle;
//import android.view.KeyEvent;
//
//import com.facebook.react.LifecycleState;
//import com.facebook.react.ReactInstanceManager;
//import com.facebook.react.ReactRootView;
//import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
//import com.facebook.react.shell.MainReactPackage;
//import com.kxf.androidtestdemo.BuildConfig;
//import com.kxf.androidtestdemo.R;
//
//public class MyReactActivity extends BaseActivity implements DefaultHardwareBackBtnHandler {
//    private ReactRootView mReactRootView;
//    private ReactInstanceManager mReactInstanceManager;
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_my_react);
//
//        mReactRootView = findViewById(R.id.rrv);
//        mReactInstanceManager = ReactInstanceManager.builder()
//                .setApplication(getApplication())
//                .setBundleAssetName("index.bundle")
////                .setJSMainModulePath("index")
//                .setJSMainModuleName("index.android")
//                .addPackage(new MainReactPackage())
////                .addPackage(new MyReactPackage())
//                .setUseDeveloperSupport(BuildConfig.DEBUG)
//                .setInitialLifecycleState(LifecycleState.BEFORE_RESUME)
////                .setDefaultHardwareBackBtnHandler(this)
//                .build();
//        mReactRootView.startReactApplication(mReactInstanceManager, "MyRnTest", null);
//    }
//
//    @Override
//    protected void onResume() {
//        super.onResume();
//
////        if (mReactInstanceManager != null) {
////            mReactInstanceManager.onHostResume(this);
////        }
//    }
//
//    @Override
//    protected void onPause() {
//        super.onPause();
//
////        if (mReactInstanceManager != null) {
////            mReactInstanceManager.onHostPause(this);
////        }
//    }
//
//    @Override
//    protected void onDestroy() {
//        super.onDestroy();
////        if (mReactInstanceManager != null) {
////            mReactInstanceManager.onHostDestroy(this);
////        }
//    }
//
//    @Override
//    public void invokeDefaultOnBackPressed() {
//        super.onBackPressed();
//        this.finish();
//    }
//
//
//    @Override
//    public void onBackPressed() {
//        if (mReactInstanceManager != null) {
//            mReactInstanceManager.onBackPressed();
//        } else {
//            super.onBackPressed();
//        }
//    }
//
//
//    @Override
//    public boolean onKeyUp(int keyCode, KeyEvent event) {
//        if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) {
//            mReactInstanceManager.showDevOptionsDialog();
//            return true;
//        }
//        return super.onKeyUp(keyCode, event);
//    }
//}